package com.linwen.javase.thread.threadlocal;

public class MyThreadLocal {
    static ThreadLocal<MyProject> threadLocal = new ThreadLocal();


    public static void doSomeThing(int i){
        try{
            MyProject myProject = new MyProject(String.valueOf(i));
            threadLocal.set(myProject);
            System.out.println(threadLocal.get().name);
        }
        finally {
              threadLocal.remove();
        }
    }

    static class MyProject{
        public MyProject(String name) {
            this.name = name;
        }

        private String name;
        private byte[] oneMB = new byte[1024*1024];

    }
}
